﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="copyright" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<title>活动管理-创建-编辑</title>
<link href="<%=path%>/favicon.ico" rel="shortcut icon">
<link href="https://cdn.jsdelivr.net/gh/bootcdn/BootCDN/ajax/libs/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css"
	href="<%=path%>/css/marketing/public.css" />
<link rel="stylesheet" type="text/css"
	href="<%=path%>/css/marketing/activity.css" />
<link rel="stylesheet" type="text/css"
	href="<%=path%>/css/marketing/marketing.css" />
<link rel="stylesheet" type="text/css"
	href="<%=path%>/css/marketing/style_list.css" />


<link href="<%=path%>/css/marketing/s_style.css" rel="stylesheet">
<link href="<%=path%>/hplus/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
<link href="<%=path%>/hplus/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
<link href="<%=path%>/hplus/css/plugins/iCheck/custom.css" rel="stylesheet">
<link href="<%=path%>/hplus/css/animate.min.css" rel="stylesheet">
<link href="<%=path%>/hplus/css/style.min862f.css?v=4.1.0" rel="stylesheet">	
<link rel="stylesheet" type="text/css" href="<%=path%>/hplus/js/plugins/sweetalert/sweetalert2.min.css">

<style>
.k_activity .s_hdjs ol {
    padding: 20px 3% 30px;
}
.x_img_sc {
	position: relative;
}

.x_img_sc .ad_close {
	width: 16px;
	height: 16px;
	position: absolute;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.8);
}

.x_img_sc .ad_close img {
	width: 100%;
}

.x_editor_pic1 li #tabs li {
	height: 35px;
	margin-top: 0;
}

.s_imgs {
	height: 33px;
	line-height: 36px;
	margin-bottom: 6px;
	color: #666;
}

    .s_hdjs li a{
        float: right;
        color: #ffc105;
        text-decoration: underline;
    }

    .s_left_phone{
        position: relative;
    }

    .sjmp{
        position: absolute;
        right: 0;
        top:140px;
        padding: 10px;
        width: 40px;
        background: #fff;
        z-index: 22;
        color: #ffc105;
        border: 1px solid #eee;
    }
    .sjmp img{
        margin-left: -5px;
        margin-bottom: 5px;
    }
    
    .kkk li{
        margin-top: -5px;
    }

    .s_bj{
        width: 100px;
        height: 40px;
        line-height: 40px;
        text-align: center;
        border: none;
        border: 1px solid #ddd;
        border-radius: 3px;
        margin-bottom: 6px;
    }
    
    .k_xz_input li{
        width: 100%;
        height: 48px;
        line-height: 48px;
        float: left;
    }

    .k_xz_input li input{
        width: 80px;
        height: 40px;
        line-height: 40px;
        border-radius: 3px;
        margin: 0 6px;
    }

    .k_xz_input li input.k_dx{
        width: 14px;
    }

    .x_padding10 .k_lj{
        color: #03a9f4;
        float: right;
        text-decoration: underline;
        margin-top: -10px;
    }
    
    .col-sm-6{
    	padding-left:0;
    }
    
    .x_basics_list .k_xz_input li{
    	margin:0;
    }
</style>
</head>
<body class="gray-bg">

	<div class="wrapper wrapper-content animated fadeInRight">
	<div class="container-fluid">
		
		<div class="row">
				 <div class="col-md-12">
                   <div class="x_progress s_big">
		            <div class="s_line">
		                <div class="s_progress_bar s_current" role="progressbar"
		                     aria-valuenow="60" aria-valuemin="0" aria-valuemax="100">
		                    <span class="sr-only_1">1</span>
		                    <p class="x_color_bz">选择模板</p >
		                </div>
		                <div class="s_progress_bar s_current" role="progressbar"
		                     aria-valuenow="60" aria-valuemin="0" aria-valuemax="100">
		                    <span class="sr-only_2">2</span>
		                    <p class="x_color_bz">编辑内容</p >
		                </div>
		                <div class="s_progress_bar" role="progressbar"
		                     aria-valuenow="60" aria-valuemin="0" aria-valuemax="100">
		                    <span class="sr-only_3">3</span>
		                    <p class="x_color_bz">分享设置</p >
		                </div>
		                <div class="s_progress_bar" role="progressbar"
		                     aria-valuenow="60" aria-valuemin="0" aria-valuemax="100">
		                    <span class="sr-only_4">4</span>
		                    <p class="x_color_bz">活动预览</p >
		                </div>
		                <div class="s_progress_bar" role="progressbar"
		                     aria-valuenow="60" aria-valuemin="0" aria-valuemax="100">
		                    <span class="sr-only_5">5</span>
		                    <p class="x_color_bz">分享</p >
		                </div>
		            </div>
		          </div>
				<div class="x_template ">
					<!--内容左侧-->
					<div class="x_basics_list x_basics x_floatl x_w  x_padding10">
						<h2>促销模板</h2>
						<a href="<%=path%>/api/bm/ui/createActivity1" class="k_lj">重新选择模板</a>
						<div class="x_basics x_floatl x_l">
							<div class="s_activity_body s_left_phone">
								<div class="k_title1">
									<img src="<%=path%>/images/marketing/icon_home.png" /> <span
										id="title">19.8元吃金牌烤鸭|转发有礼</span>
								</div>

								<div class="s_slide" style="height: 250px;">
									<ul class="fix">
										<li><img src="<%=path%>/images/marketing/k_banner.png"
											id="banner" onerror="javascript:this.src='<%=path%>/images/marketing/k_banner.png'"/>
											<div class="s_slide_con">
												<!-- 		<p>奔跑的苹果：很好吃非常好吃非常好吃</p>
												<p>奔跑的苹果：很好吃非常好吃非常好吃</p> -->
												<h4>
													<%-- 		 <a href="javascript:;"><img
														src="<%=path%>/images/marketing/icon_dh.png" /></a> <a
														href="javascript:;"><img
														src="<%=path%>/images/marketing/icon_heart.png" /></a> --%>
												</h4>
											</div></li>
									</ul>
								</div>
								<p class="sjmp"><img src="<%=path%>/images/marketing/sjmp.png" /><i id="sjmp">商家名片</i></p>
								<ul class="s_detailed fix">
									<li id="li_environment"><span><img src="<%=path%>/images/marketing/s_dg.png" />免预约</span>
										<span><img src="<%=path%>/images/marketing/s_dg.png" />有停车位</span> <span><img
											src="<%=path%>/images/marketing/s_dg.png" />适用门店/全部</span></li>
									<li id="li_address">地址：<em><img
											src="<%=path%>/images/marketing/icon_phones.png" /></em>
									</li>
									<a href=""><li id="store_num"><span class="into"></span></li></a>
								</ul>

								<div class="k_activity">
									<h3 id="h3_price">
										<aa id="unitPrice2"></aa>
										&nbsp;&nbsp;<span><h id="priceHint">原价</h><em
											id="groupPrice2"></em></span>
									</h3>
									<div class="s_hdjs">
										<span id="content_text">活动介绍</span>
										<ol id="activity_description">
											<li>1、提交参与信息后转发本活动</li>
											<li>2、邀请5名好友转发即可获得0元烤鸭</li>
											<li>3、先到先得 赶快转发吧！</li>
											<li>4、邀请5名好友转发即可获得0元烤鸭</li>
											<li>5、先到先得 赶快转发吧！</li>
											<li>6、活动截止到12月30日</li>
											<li><a href="javascript:;">活动细则</a></li>
										</ol>
									</div>
								    <div id="left_commit">
								      <div class="s_get_btn">立即领取</div>
								    </div>
									
								</div>

								<ul class="s_footer">
									<li><img src="<%=path%>/images/marketing/icon_wb.png"
										id="erweima_weixin2" />
										<p>微信二维码</p></li>
									<li><img src="<%=path%>/images/marketing/icon_wb.png"
										id="erweima_weibo2" />
										<p>微博二维码</p></li>
								</ul>
								<p style="text-align:center;color:#bdbdbd">zhfeat提供技术服务</p>
								<div class="s_popups">
									<div class="s_detailed_rule">
										<p>活动细则</p>
										<em><img src="<%=path%>/images/marketing/k_close.png" /></em>
										<ul>
											<li>1.提交参与信息后转发本活动</li>
											<li>2.邀请5名好友转发即可获得0元烤鸭</li>
											<li>3.先到先得 赶快转发吧！</li>
										</ul>
									</div>
								</div>
							</div>
						</div>
						<!--活动预览部分end-->
						<div class="x_floatr x_r x_top10 x_padding10"
							style="margin-top: 20px;">
							<div class="x_editor">
								<div class="form-group">
									<label for="firstname" class="col-sm-2 control-label"><b
										style="color: red">*</b>&nbsp;主题</label>
									<div class="col-sm-10">
										<input type="text" class="form-control" id="firstname"
											placeholder="不超过25个字" maxlength="50"
											onblur="checkLength(this)">
									</div>
									<div class="clear-shadow"></div>
								</div>
								<div class="form-group x_footer_information  ">
									<label for="lastname" class="col-sm-2 control-label"><b
										style="color: red">*</b>&nbsp;图片</label>
									<form class="col-sm-10" id='upload_pic'
										enctype='multipart/form-data'>
										<!-- <p class="s_imgs">750*350px，1M以内，支持PNG、JPG</p> -->
										<ul id="pics" class="fix">
											<li>
												<div class="x_pt_h">
													<div class="x_img_sc">
														<img id="img1" src="<%=path%>/images/marketing/img_p.png"
															width="100%" height="100%"> <img hidden id="close1"
															class="ad_close" indexNum="1" imageId="img1"
															src="<%=path%>/images/marketing/ad_close.png" />
													</div>
													<input accept="image/gif,image/jpeg,image/x-png"
														type="file" id="x_inputfile" onchange="uploadPic(1)"
														name="filepath1" alt="filepath1"
														style="filter: alpha(opacity = 50); -moz-opacity: 0.5; -khtml-opacity: 0.5; opacity: 0.0; position: absolute; z-index: 99; width: 84px; height: 84px;">
												</div>
												<div class="x_line_h">图1</div>
											</li>
											<li>
												<div class="x_pt_h">
													<div class="x_img_sc">
														<img id="img2" src="<%=path%>/images/marketing/img_p.png"
															width="100%" height="100%"> <img hidden id="close2"
															class="ad_close" indexNum="2" imageId="img2"
															src="<%=path%>/images/marketing/ad_close.png" />
													</div>
													<input accept="image/gif,image/jpeg,image/x-png"
														type="file" id="x_inputfile" onchange="uploadPic(2)"
														name="filepath2"
														style="filter: alpha(opacity = 50); -moz-opacity: 0.5; -khtml-opacity: 0.5; opacity: 0.0; position: absolute; z-index: 99; width: 84px; height: 84px;">
												</div>
												<div class="x_line_h">图2</div>
											</li>
											<li>
												<div class="x_pt_h">
													<div class="x_img_sc">
														<img id="img3" src="<%=path%>/images/marketing/img_p.png"
															width="100%" height="100%"> <img hidden id="close3"
															class="ad_close" indexNum="3" imageId="img3"
															src="<%=path%>/images/marketing/ad_close.png" />
													</div>
													<input accept="image/gif,image/jpeg,image/x-png"
														type="file" id="x_inputfile" onchange="uploadPic(3)"
														name="filepath3"
														style="filter: alpha(opacity = 50); -moz-opacity: 0.5; -khtml-opacity: 0.5; opacity: 0.0; position: absolute; z-index: 99; width: 84px; height: 84px;">
												</div>
												<div class="x_line_h">图3</div>
											</li>
										</ul>
										<p class="s_imgs">建议图片尺寸为：750x350px</p>
									</form>
									<div class="clear-shadow"></div>

									<div class="clear-shadow"></div>
								</div>

								<div class="x_editor_pic1 fix">
                                    <label for="lastname" style="text-align:left;" class="col-sm-6 control-label"><img src="<%=path%>/images/marketing/s_check_no.png" class="s_fk_pic1 show_card" />显示分享人名片</label><br />
                                    <li class="s_typeCheck col-sm-11">
                                        <ol class="fix">
                                            <li>
                                                按钮文字
                                                <input id="input_card_text" type="text" style="width:100px;" placeholder="例：商家名片" maxlength="5" onblur="checkLength(this)" oninput="reloadLeft()"/>
                                                <i style="color:#bdbdbd">(不超过5个字)</i>
                                            </li>
                                        </ol>
                                    </li>
                                </div><br />
								<div class="x_editor_pic1">
									<label for="lastname" class="col-sm-2 control-label"
										style="text-align: left;"><img src="<%=path%>/images/marketing/s_check_no.png" class="s_fk_pic1 show_equipment" />环境设施</label>
									<li class="s_typeCheck col-sm-11">
										<ol class="fix" id="tabs">
											<li class="s_fx_li1"><img name="免预约" id="free_subscribe"
												src="<%=path%>/images/marketing/s_check_no.png"
												class="s_fk_pic1 isChecked commit" />免预约</li>
											<li class="s_fx_li2"><img name="有停车位" id="parking_space"
												src="<%=path%>/images/marketing/s_check_no.png"
												class="s_fk_pic2 isChecked commit" />有停车位</li>
											<li class="s_fx_li3"><img name="适用全部门店"
												id="apply_all_store"
												src="<%=path%>/images/marketing/s_check_no.png"
												class="s_fk_pic3 isChecked commit" />适用全部门店</li>
											<li class="s_fx_li4"><input type="text"
												placeholder="自定义" id="ziDingYi" maxlength="6"
												onblur="checkLength(this)" />
												<i style="color:#bdbdbd">(点击enter键添加)</i>
											</li>
										</ol>
									</li>
								</div>
								<div class="x_list_style">
									<ul class="x_title">
										<li class="x_list01"><span>参与门店</span></li>
										<li class="x_list02"><a style="color: #03a9f4;margin-left:30px" id="bm_cmen" data-toggle="modal" href="<%=path%>/api/bm/ui/store" data-target="#store_modal">
												选择门店
											</a></li>
									</ul>
									<div class="clear-shadow"></div>
									<div class="x_list_center01 " style="display: none">
										<div class="panel panel-default">
											<div class="panel-body">
												<ul>

												</ul>
											</div>
										</div>
									</div>
									<div class="x_list_center02" style="display: block">
										<div class="panel panel-default">
											<div class="panel-body" style="background-color: #e2f0f7;">
												<ul id="bm_md_list">


												</ul>
											</div>
										</div>
										<div class="clear-shadow"></div>
									</div>
									
									<div class="x_top10 x_editor_pic1">
										<label for="lastname" style="text-align:left;" class="col-sm-2 control-label"><img src="<%=path%>/images/marketing/s_check_no.png" class="s_fk_pic1 show_activity_way" />活动方式</label>
										<ul class="fix kkk">
											<!-- <li><span>活动方式</span></li> -->
											<li><label> <!--                                                     	<button type="button" class="btn btn-default">19.8元</button> -->
													<input id="unitPrice" type="text" class="s_bj"
													value="" size="8" maxlength="6" onblur="checkLength(this)"
													placeholder="输入价格" />
											</label></li>
											<li><label> <!-- <button type="button" class="btn btn-default">原价</button> -->
													<input id="input_priceHint" type="text" class="s_bj"
													 value="" size="8" maxlength="6"
													onblur="checkLength(this)" oninput="reloadLeft()"
													placeholder="输入文本" />

											</label></li>
											<li><label> <!--                                                     	<button type="button" class="btn btn-default">128元</button> -->
													<input id="groupPrice" type="text" class="s_bj"
													value="" size="8" maxlength="6" onblur="checkLength(this)"
													placeholder="输入原价" />
											</label></li>
										</ul>
									</div>
									<div class="clear-shadow"></div>
									<!--活动限制-->
									<!-- <div class="x_top10 x_activity">
										<ul class="form">
											<li class="x_radio_li1"><span><b
													style="color: red">*</b>&nbsp;参与条件</span><label
												class="checkbox-inline i-checks"
												style="padding: 0; margin-left: 20px;"> <img
													id="restrict_no" src="<%=path%>/images/marketing/img_radio.png"
													class="x_radio_pic1 isRadio" />所有人均可参与
											</label></li>
											<br />
											<li class="x_radio_li1"><label
												class="checkbox-inline i-checks"
												style="padding: 0; margin-left: 77px;"> <img
													id="restrict_click"
													src="<%=path%>/images/marketing/img_radio_n.png"
													class="x_radio_pic2 isRadio" /> <aa>点击人数超过</aa>
											</label> <input type="text" class="input-medium"
												id="exampleInputName1" placeholder=""
												style="ime-mode: disabled;" onkeypress="keyPress()"
												maxlength="6">
											<aa>可参与</aa></li>
											<br>
											<li class="x_radio_li4"><label
												class="checkbox-inline i-checks"
												style="padding: 0; margin-left: 77px;"> <img
													id="restrict_transmit"
													src="<%=path%>/images/marketing/img_radio_n.png"
													class="x_radio_pic4 isRadio" /> <aa>转发人数超过</aa>
											</label> <input type="text" class="input-medium"
												id="exampleInputName3" placeholder=""
												style="ime-mode: disabled;" onkeypress="keyPress()"
												maxlength="6">
											<aa>可参与</aa></li>
										</ul>
									</div>
									<div class="clear-shadow"></div> -->
								</div>
								<div class="clear-shadow"></div>
								<!--活动限制end-->
								<!--活动介绍-->
							<!-- 	<div class="x_top10">
									<span><b style="color: red">*</b>&nbsp;活动介绍</span>
									<h3></h3>
									<div class="panel panel-default">
										<div class="panel-body">
											<textarea id="activityPresentation" rows="" cols=""
												style="width: 100%; height: 150px; border: 0; color: #999999;">
												1.提交参与信息后转发本活动
												2.邀请5名好友转发即可获得0元烤鸭
												3.先到先得 赶快转发吧！
												</textarea>
										</div>
									</div>
								</div> -->
								<div class="x_top10">
                                    <input id="input_activity_content_text" type="text" class="s_bj" value="活动介绍" oninput="reloadLeft()"/>
                                    <textarea id="activityPresentation" rows="" cols="" class="panel panel-default panel-body" maxlength="200" onblur="checkLength(this)"></textarea>
                                </div>
								<!--活动细则-->
<!-- 								<div class="x_activity ">
									<span><b style="color: red">*</b>&nbsp;活动细则</span>
									<h3></h3>
									<div class="panel panel-default">
										<div class="panel-body">
											<textarea id="activity_detail_rule" rows="" cols=""
												style="width: 100%; height: 200px; border: 0; color: #999999;">
1.活动需邀请3名好友点击后，即可获得50元现金券，到店消费满149元可用，仅限堂食，不包含酒水，不与店内其他优惠同享；
2.活动时间：2017年5月20日,30天内有效期；
3领取优惠券成功后即可收到券码短信，短信有延迟现象，若24小时内未收到短信请您联系：010-68686688；
4.每个用户ID仅限领取1次，禁止恶意刷单，如有发现本店有权拒绝就餐；
5.餐厅地址：北京市大兴区亦庄开发区。

			联系电话：010-686866886.
			本活动最终解释权归本店所有
                                            	</textarea>
										</div>
									</div>
								</div> -->
								<div class="x_activity">
                                    <input id="input_activity_rule_text" type="text" class="s_bj" value="活动细则"  oninput="reloadLeft()"/>
                                    <textarea id="activity_detail_rule" rows="" cols="" class="panel panel-default panel-body" maxlength="200" onblur="checkLength(this)"></textarea>
                                </div>
							</div>


							<!-- <div class="">
								<span><b style="color: red">*</b>&nbsp;收集用户信息</span><br>
								<div class="x_editor_pic1">
									<ul id="customerInfo">
										<li>
											<ol class="fix">
												<li class="s_fx_li5"><img id="commit_name"
													src="<%=path%>/images/marketing/s_check_no.png"
													class="s_fk_pic5 isChecked commit" _name="name"
													style="margin-left: 40px;" />姓名</li>
												<li class="s_fx_li6"><img id="commit_mobile"
													src="<%=path%>/images/marketing/s_check_no.png"
													class="s_fk_pic6 isChecked commit" _name="phone" />电话</li>
												<li class="s_fx_li7"><img id="commit_email"
													src="<%=path%>/images/marketing/s_check_no.png"
													class="s_fk_pic7 isChecked commit" _name="email" />邮箱</li>
												<li class="s_fx_li8"><img id="commit_weibo"
													src="<%=path%>/images/marketing/s_check_no.png"
													class="s_fk_pic8 isChecked commit" _name="weibo" />微博</li>
												<li class="s_fx_li9"><img id="commit_weixin"
													src="<%=path%>/images/marketing/s_check_no.png"
													class="s_fk_pic9 isChecked commit" _name="weixin" />微信</li>
												<br />
												<br>
												<li class="s_fx_li10"><img id="commit_job"
													src="<%=path%>/images/marketing/s_check_no.png"
													class="s_fk_pic10 isChecked commit" _name="job"
													style="margin-left: 40px;" />职位</li>
												<li class="s_fx_li11"><img id="commit_company"
													src="<%=path%>/images/marketing/s_check_no.png"
													class="s_fk_pic11 isChecked commit" _name="company" />公司</li>
											</ol>
										</li>
									</ul>
									<div class="clear-shadow"></div>
									<div class="x_top10 ">
										<h4 style="margin-left: 40px;">
											<small>建议不超过勾选3项，否则影响转化率</small>
										</h4>
									</div>
									<div class="clear-shadow"></div>
								</div>
								<br>
								<div class="x_editor_pic1 ">
									<span><b style="color: red">*</b>&nbsp;通知客户方式</span><br>
									<ul>
										<li style="margin-left: 40px;">
											<ol class="fix" id="coupon_send_type">
												<li class="s_fx_li14"><img id="send_sms"
													src="<%=path%>/images/marketing/s_check_no.png"
													class="s_fk_pic14 isChecked" _id="27" />短信</li>
												<li class="s_fx_li15"><img id="send_email"
													src="<%=path%>/images/marketing/s_check_no.png"
													class="s_fk_pic15 isChecked" _id="29" />邮箱</li>
												<li class="s_fx_li16"><img id="send_weibo"
													src="<%=path%>/images/marketing/s_check_no.png"
													class="s_fk_pic16 isChecked" _id="31" />微博</li>
												<li class="s_fx_li17"><img id="send_generate"
													src="<%=path%>/images/marketing/s_check.png" class="s_fk_pic17"
													_id="33" />页面自动生成</li>
											</ol>
										</li>
									</ul>
								</div>
								<br>
								<div class="x_footer_information  ">
									<span>页脚信息</span><br>
									<br>
									<ul>
										<li style="margin-left: 40px;">
											<form id='_weixin_qrcode' enctype='multipart/form-data'>
												<div class="x_pt_h">
													<div class="x_img_sc">
														<img id="img4" src="<%=path%>/images/marketing/img_p.png"
															width="100%" height="100%">
													</div>

													<input accept="image/gif,image/jpeg,image/x-png"
														type="file" id="x_inputfile"
														onchange="fileloadon('weixin')" name="weixin_qrcode"
														style="filter: alpha(opacity = 50); -moz-opacity: 0.5; -khtml-opacity: 0.5; opacity: 0.0; position: absolute; z-index: 99;">
												</div>
											</form>

											<div class="x_line_h s_fx_li12">
												<img id="erweima_weixin"
													src="<%=path%>/images/marketing/s_check_no.png" class="s_fk_pic12"
													_id="23" /> 微信二维码
											</div>

										</li>

										<li>
											<form id='_weibo_qrcode' enctype='multipart/form-data'>
												<div class="x_pt_h">
													<div class="x_img_sc">
														<img id="img5" src="<%=path%>/images/marketing/img_p.png"
															width="100%" height="100%" />
													</div>
													<input accept="image/gif,image/jpeg,image/x-png"
														type="file" id="x_inputfile"
														onchange="fileloadon('weibo')" name="weibo_qrcode"
														style="filter: alpha(opacity = 50); -moz-opacity: 0.5; -khtml-opacity: 0.5; opacity: 0.0; position: absolute; z-index: 99;" />
												</div>
											</form>
											<div class="x_line_h s_fx_li13">
												<img id="erweima_weibo"
													src="<%=path%>/images/marketing/s_check_no.png" class="s_fk_pic13"
													_id="25" /> 微博二维码
											</div>
										</li>
									</ul>
									<div class="clear-shadow"></div>
								</div>
								<div class="clear-shadow"></div>
								<div class="x_top10">
									<a class=" x_button_l " style="color: #03a9f4;"
										href="<%=path%>/api/bm/ui/activityHome">取消</a> <a
										style="margin-left: 100px;" class=" x_button_y "
										href="javascript:;">暂存</a> <a style="margin-left: 10px;"
										class=" x_button " id="bm_button" href="javascript:;">下一步</a>
								</div>
							</div>
							<div class="clear-shadow"></div> -->
							<div class="x_editor_pic1">
                                        <label for="lastname" style="text-align:left;" class="col-sm-6 control-label"><img src="<%=path%>/images/marketing/s_check_no.png" class="s_fk_pic1 show_collect" />收集用户信息</label><br /><br />
                                        <div class="x_editor_pic1">
                                        <ul id="customerInfo">
										<li>
											<ol class="fix">
												<li class="s_fx_li5"><img id="commit_name"
													src="<%=path%>/images/marketing/s_check_no.png"
													class="s_fk_pic5 isChecked commit" _name="name"
													style="margin-left: 40px;" />姓名</li>
												<li class="s_fx_li6"><img id="commit_mobile"
													src="<%=path%>/images/marketing/s_check_no.png"
													class="s_fk_pic6 isChecked commit" _name="phone" />电话</li>
												<li class="s_fx_li7"><img id="commit_email"
													src="<%=path%>/images/marketing/s_check_no.png"
													class="s_fk_pic7 isChecked commit" _name="email" />邮箱</li>
												<li class="s_fx_li8"><img id="commit_weibo"
													src="<%=path%>/images/marketing/s_check_no.png"
													class="s_fk_pic8 isChecked commit" _name="weibo" />微博</li>
												<li class="s_fx_li9"><img id="commit_weixin"
													src="<%=path%>/images/marketing/s_check_no.png"
													class="s_fk_pic9 isChecked commit" _name="weixin" />微信</li>
												<li class="s_fx_li10"><img id="commit_job"
													src="<%=path%>/images/marketing/s_check_no.png"
													class="s_fk_pic10 isChecked commit" _name="job" />职位</li>
												<li class="s_fx_li11"><img id="commit_company"
													src="<%=path%>/images/marketing/s_check_no.png"
													class="s_fk_pic11 isChecked commit" _name="company" />公司</li>
											</ol>
										</li>
									</ul>
                                            <div class="clear-shadow"></div>
                                            <div class="s_typeCheck" style="margin:10px 0 0 40px;"><h4><small>建议不超过勾选3项，否则影响转化率</small></h4></div><br />
                                        </div>
                                    </div><br />

                                    <!-- 参与条件 -->
                                    <div class="x_editor_pic1">
                                        <label for="lastname" style="text-align:left;" class="col-sm-6 control-label">参与条件</label><br />
                                        <!-- <ul class="k_xz_input">
                                            <li><input name="Fruit" type="radio" class="k_dx" />所有人均可参加</li>
                                            <li><input name="Fruit" type="radio" class="k_dx" />点击人数超过<input type="number" />允许参与</li>
                                            <li><input name="Fruit" type="radio" class="k_dx" />点赞人数超过<input type="number" />允许参与</li>
                                            <li><input name="Fruit" type="radio" class="k_dx" />转发人数超过<input type="number" />允许参与</li>
                                        </ul> -->
                                        <ul class="form k_xz_input">
											<li class="x_radio_li1"><!-- <span><b
													style="color: red">*</b>&nbsp;参与条件</span> --><label
												class="checkbox-inline i-checks"
												style="padding: 0;margin-left:30px;"> <img
													id="restrict_no" src="<%=path%>/images/marketing/img_radio.png"
													class="x_radio_pic1 isRadio" />所有人均可参与
											</label></li>
											<br />
											<li class="x_radio_li1"><label
												class="checkbox-inline i-checks"
												style="padding: 0;margin-left:30px;""> <img
													id="restrict_click"
													src="<%=path%>/images/marketing/img_radio_n.png"
													class="x_radio_pic2 isRadio" /> <aa>点击人数超过</aa>
											</label> <input type="text" class="input-medium"
												id="exampleInputName1" placeholder=""
												style="ime-mode: disabled;" onkeypress="keyPress()"
												maxlength="6">
											<aa>允许参与</aa></li>
											<br>
											<li class="x_radio_li4"><label
												class="checkbox-inline i-checks"
												style="padding: 0;margin-left:30px;""> <img
													id="restrict_transmit"
													src="<%=path%>/images/marketing/img_radio_n.png"
													class="x_radio_pic4 isRadio" /> <aa>转发人数超过</aa>
											</label> <input type="text" class="input-medium"
												id="exampleInputName3" placeholder=""
												style="ime-mode: disabled;" onkeypress="keyPress()"
												maxlength="6">
											<aa>允许参与</aa></li>
										</ul>
                                    </div><br />


                                    <div class="x_editor_pic1">
                                        <label for="lastname" style="text-align:left;" class="col-sm-6 control-label"><img src="<%=path%>/images/marketing/s_check_no.png" class="s_fk_pic1 show_sendType" />通知客户方式</label>
                                        <div class="clear-shadow"></div>
                                        <li class="s_typeCheck col-sm-11">
                                           <ol class="fix" id="coupon_send_type" style="margin-top:8px;">
												<li class="s_fx_li14"><img id="send_sms"
													src="<%=path%>/images/marketing/s_check_no.png"
													class="s_fk_pic14 isChecked" _id="27" />短信</li>
												<li class="s_fx_li15"><img id="send_email"
													src="<%=path%>/images/marketing/s_check_no.png"
													class="s_fk_pic15 isChecked" _id="29" />邮箱</li>
												<li class="s_fx_li16"><img id="send_weibo"
													src="<%=path%>/images/marketing/s_check_no.png"
													class="s_fk_pic16 isChecked" _id="31" />微博</li>
												<li class="s_fx_li17"><img id="send_generate"
													src="<%=path%>/images/marketing/s_check.png" class="s_fk_pic17"
													_id="33" />页面自动生成</li>
											</ol>
                                        </li>
                                    </div>
                                    <div class="clear-shadow"></div><br />

                                    <%-- <div class="x_footer_information x_editor_pic1">
                                        <label for="lastname" style="text-align:left;" class="col-sm-6 control-label"><img src="<%=path%>/images/marketing/s_check_no.png" class="s_fk_pic1 show_foot_info" />页脚信息</label><br /><br />
                                        <ul class="s_typeCheck">
                                            <li>
                                                <div class="x_pt_h">
                                                    <div class="x_img_sc"><img src="<%=path%>/images/marketing/img_p.png"></div>
                                                    <input type="file" id="x_inputfile" style=" filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity: 0.5; opacity: 0.0; position:absolute; z-index:99;">
                                                </div>
                                                <div class="x_line_h s_fx_li12"><img src="<%=path%>/images/marketing/s_check_no.png" class="s_fk_pic12" _id="23" /> 微博二维码</div>
                                            </li>
                                            <li>
                                                <div class="x_pt_h">
                                                    <div class="x_img_sc"><img src="<%=path%>/images/marketing/img_p.png"></div>
                                                    <input type="file" id="x_inputfile" style=" filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity: 0.5; opacity: 0.0; position:absolute; z-index:99;">
                                                </div>
                                                <div class="x_line_h s_fx_li13"><img src="<%=path%>/images/marketing/s_check_no.png" class="s_fk_pic13" _id="25" /> 微博二维码</div>
                                            </li>
                                        </ul>
                                        <div class="clear-shadow"></div><br />
                                    </div> --%>
                                    <div class="x_footer_information x_editor_pic1">
									
 <label for="lastname" style="text-align:left;" class="col-sm-6 control-label"><img src="<%=path%>/images/marketing/s_check_no.png" class="s_fk_pic1 show_foot_info" />页脚信息</label><br /><br />
									<br>
									<ul>
										<li style="margin-left: 40px;">
											<form id='_weixin_qrcode' enctype='multipart/form-data'>
												<div class="x_pt_h">
													<div class="x_img_sc">
														<img id="img4" src="<%=path%>/images/marketing/img_p.png"
															width="100%" height="100%">
													</div>

													<input accept="image/gif,image/jpeg,image/x-png"
														type="file" id="x_inputfile"
														onchange="fileloadon('weixin')" name="weixin_qrcode"
														style="filter: alpha(opacity = 50); -moz-opacity: 0.5; -khtml-opacity: 0.5; opacity: 0.0; position: absolute; z-index: 99;">
												</div>
											</form>

											<div class="x_line_h s_fx_li12">
												<img id="erweima_weixin"
													src="<%=path%>/images/marketing/s_check_no.png" class="s_fk_pic12"
													_id="23" /> 微信二维码
											</div>

										</li>

										<li>
											<form id='_weibo_qrcode' enctype='multipart/form-data'>
												<div class="x_pt_h">
													<div class="x_img_sc">
														<img id="img5" src="<%=path%>/images/marketing/img_p.png"
															width="100%" height="100%" />
													</div>
													<input accept="image/gif,image/jpeg,image/x-png"
														type="file" id="x_inputfile"
														onchange="fileloadon('weibo')" name="weibo_qrcode"
														style="filter: alpha(opacity = 50); -moz-opacity: 0.5; -khtml-opacity: 0.5; opacity: 0.0; position: absolute; z-index: 99;" />
												</div>
											</form>
											<div class="x_line_h s_fx_li13">
												<img id="erweima_weibo"
													src="<%=path%>/images/marketing/s_check_no.png" class="s_fk_pic13"
													_id="25" /> 微博二维码
											</div>
										</li>
									</ul>
									<div class="clear-shadow"></div>
								</div>

                                    <div class="x_top10">
                                        <form role="form">
                                            <div class="row">
                                                <div class=" x_floatl ">
                                                    <a class=" x_button_l " style="color: #03a9f4;" href="<%=path%>/api/bm/ui/activityHome">取消</a>
                                                </div>
                                                <div class=" x_floatr" style="margin-left:30px;">
                                                    <a class=" x_button " id="bm_button" href="javascript:;">下一步</a>
                                                </div>
                                                <div class="x_floatr">
                                                    <a class=" x_button_y " href="javascript:;">保存</a>
                                                </div>
                                            </div>
                                        </form>
                                    </div>
                                    <div class="clear-shadow"></div>
						</div>
					</div>
				</div>
				<!--内容左侧end-->

			</div>
		</div>
	</div>
	</div>

   <div class="modal inmodal fade" id="store_modal" tabindex="-1" role="dialog"  aria-hidden="true">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    <h4 class="modal-title">窗口标题</h4>
                </div>
                <div class="modal-body">
                </div>

                <div class="modal-footer">
                    <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary">保存</button>
                </div>
            </div>
        </div>
    </div>


    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
    <script src="<%=path%>/hplus/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="<%=path%>/hplus/js/content.min.js?v=1.0.0"></script>
    <script src="<%=path%>/hplus/js/plugins/sweetalert/sweetalert2.min.js"></script>
    <script type="text/javascript" src="<%=path%>/js/marketing/dialog.js"></script>
    <script src="<%=path%>/hplus/js/plugins/iCheck/icheck.min.js"></script>
	<script>
	
	var choseQrWeixinFlag=false;
	var choseQrWeiboFlag=false;
	
	$('.s_fx_li12').click(function(){
		var id = $(this).find('img').attr('_id');
		console.log("----11--->"+id);
		 if(StringEmpty(weixin_qrcode)){
			 if(id == 23){
					choseQrWeixinFlag=false;
				  $('.s_fk_pic12').attr('src', '<%=path%>/images/marketing/s_check_no.png');
				  $(this).find('img').attr('_id' , '24');
				}else{
					choseQrWeixinFlag=true;
				  $('.s_fk_pic12').attr('src', '<%=path%>/images/marketing/s_check.png');
				  $(this).find('img').attr('_id' , '23');
				} 
		 }
		
		
	});
	$('.s_fx_li13').click(function(){
	  var id = $(this).find('img').attr('_id');
	  console.log("---22---->"+id);
	  if(StringEmpty(weibo_qrcode)){
		  if(id == 25){
				choseQrWeiboFlag=false;
			  $('.s_fk_pic13').attr('src', '<%=path%>/images/marketing/s_check_no.png');
			  $(this).find('img').attr('_id' , '26');
			}else{
				choseQrWeiboFlag=true;
			  $('.s_fk_pic13').attr('src', '<%=path%>/images/marketing/s_check.png');
			  $(this).find('img').attr('_id' , '25');
			}
	  }
		
	});
	  
       $('.s_fx_li14').click(function () {
    	var tempCommit1=commit_info.split(",");
    	var commit_tag1=false;
	    for(var i=0 ;i<tempCommit1.length;i++){
	    	if(tempCommit1[i]=="commit_mobile"){
	    		commit_tag1=true;
	    	}
	    }
        var id = $(this).find('img').attr('_id');
        if (id == 28) {
            $('.s_fk_pic14').attr('src', '<%=path%>/images/marketing/s_check_no.png');
            $(this).find('img').attr('_id', '27');
        } else {
        	if(commit_tag1){
        		$('.s_fk_pic14').attr('src', '<%=path%>/images/marketing/s_check.png');
                $(this).find('img').attr('_id', '28');
        	}else{
        		promptDialog("请先在收集用户信息勾选电话");
        	}
        } 
        reloadLeft();
    });
    $('.s_fx_li15').click(function () {
    	var tempCommit1=commit_info.split(",");
    	var commit_tag1=false;
	    for(var i=0 ;i<tempCommit1.length;i++){
	    	if(tempCommit1[i]=="commit_email"){
	    		commit_tag1=true;
	    	}
	    }
        var id = $(this).find('img').attr('_id');
        if (id == 30) {
            $('.s_fk_pic15').attr('src', '<%=path%>/images/marketing/s_check_no.png');
            $(this).find('img').attr('_id', '29');
        } else {
        	if(commit_tag1){
        		$('.s_fk_pic15').attr('src', '<%=path%>/images/marketing/s_check.png');
                $(this).find('img').attr('_id', '30');
        	}else{
        		promptDialogpromptDialog("请先在收集用户信息勾选邮箱");
        	}
        }
        reloadLeft();
    });
     $('.s_fx_li16').click(function () {
    	 var tempCommit1=commit_info.split(",");
     	var commit_tag1=false;
 	    for(var i=0 ;i<tempCommit1.length;i++){
 	    	if(tempCommit1[i]=="commit_weibo"){
 	    		commit_tag1=true;
 	    	}
 	    }
        var id = $(this).find('img').attr('_id');
        if (id == 32) {
            $('.s_fk_pic16').attr('src', '<%=path%>/images/marketing/s_check_no.png');
            $(this).find('img').attr('_id', '31');
        } else {
        	if(commit_tag1){
        		 $('.s_fk_pic16').attr('src', '<%=path%>/images/marketing/s_check.png');
                 $(this).find('img').attr('_id', '32');
        	}else{
        		promptDialog("请先在收集用户信息勾选微博");
        	}
           
        }
        reloadLeft();
    });
    <%-- $('.s_fx_li17').click(function () {
        var id = $(this).find('img').attr('_id');
        if (id == 33) {
            $('.s_fk_pic17').attr('src', '<%=path%>/images/marketing/s_check_no.png');
            $(this).find('img').attr('_id', '34');
        } else {
            $('.s_fk_pic17').attr('src', '<%=path%>/images/marketing/s_check.png');
            $(this).find('img').attr('_id', '33');
        }
    }); --%>
   
    
    
    $(".x_list01").click(function () {
        $(".x_list_center01").show();
        $(".x_list_center02").hide();
        $(".x_list01 h3").css("color","#03a9f4");
        $(".x_list02 h3").css("color","#666666");
    });

    $(".x_list02").click(function () {
    	 $(".x_popup_editor").css("display", "none");
	        $(".x_list_center02,.x_popup_add,.issue_add").show();
	        /*首先点选全选的图片，让全选图片变背景*/
	        $(".x_CheckBox_pic").click(function () {
	            var cutsrc = $(".x_CheckBox_pic").attr('src');
	            if (cutsrc == "<%=path%>/images/marketing/s_check_no.png") {
	                $(".x_CheckBox_pic").attr('src', '<%=path%>/images/marketing/s_check.png');
	                $(".ibox-content").find(".x_CheckBox").attr('src', '<%=path%>/images/marketing/s_check.png');
	            } else {
	                $(".x_CheckBox_pic").attr('src', '<%=path%>/images/marketing/s_check_no.png');
	                $(".ibox-content").find(".x_CheckBox").attr('src', '<%=path%>/images/marketing/s_check_no.png');
	            }
	        });
	        var bool = false;
	        $(".ibox-content").find(".x_CheckBox").click(function () {
	            if ($(this).attr("src") == "<%=path%>/images/marketing/s_check_no.png")
	                $(this).attr('src', '<%=path%>/images/marketing/s_check.png');
	            else
	                $(this).attr('src', '<%=path%>/images/marketing/s_check_no.png');
	
	            var rr = $(".ibox-content").find(".x_CheckBox");
	            if (rr != 0) {
	                $(".x_CheckBox_pic").attr('src', '<%=path%>/images/marketing/s_check_no.png');
	            } else {
	                $(".x_CheckBox_pic").attr('src', '<%=path%>/images/marketing/s_check.png');
	            }
	            for (i = 0; i < 3; i++) {
	                if (rr[i].attributes[1].nodeValue == "<%=path%>/images/marketing/s_check_no.png")
	                {
	                    bool = true;
	                    break;
	                }
	            }
	            if (bool == false) {
	                $(".x_CheckBox_pic").attr('src', '<%=path%>/images/marketing/s_check.png');
	            } else {
	                $(".x_CheckBox_pic").attr('src', '<%=path%>/images/marketing/s_check_no.png');
	            }
	        });
	        $('.issue_add > span').click(function () {
	            $('.x_popup_add,.issue_add').hide(); 
	             $(".x_popup_editor,.issue_editor").hide(); 
	        });
	
	        $(".x_button_add").click(function () {
	            $(".x_popup_t,.issue_t").show();
	            $(".x_popup_editor,.issue_editor").hide();
	          /*   $('.issue_add').hide(); */
	        })
	        $(".issue_t span").click(function () {
	            $(".x_popup_t,.issue_t").hide(); 
	           /*  $(".x_popup_editor,.issue_editor").hide();  */
	            /* $('.x_popup_add').hide(); */
	        })
	      
	        $(".x_editor_bj").click(function () {
	           $(".x_popup_editor,.issue_editor").show();
	            $(".x_popup_t,.issue_t").hide();
	            $('.issue_add').hide(); 
	        })
	        $(".issue_editor span").click(function () {
	            $(".x_popup_editor,.issue_editor").hide();
	           /*  $(".x_popup_t,.issue_t").hide();
	            $('.x_popup_add').hide();  */
	        })
	       
	        /*让所有列表中的check背景图跟随全选图的背景*/
	        $("bj").addClass("src", "<%=path%>/images/marketing/s_check.png");
	        $(".x_list_center01").hide();
	        $(".x_list02 h3").css({ "color": "#03a9f4", "text-decoration": "underline" });
	        $(".x_list01 h3").css({ "color": "#666666", "text-decoration": "none" });
    });
    
    //是否显示名片show_card
    $(document).on("click",".show_card",function(e){
			if($(this).prop("src").indexOf("s_check.png")>0){
				$(this).prop("src","<%=path%>/images/marketing/s_check_no.png");
				show_card=0;
			}else{
				$(this).prop("src","<%=path%>/images/marketing/s_check.png");
				show_card=1;
			}
			reloadLeft();
	});
    //是否显示环境设施show_equipment
    $(document).on("click",".show_equipment",function(e){
			if($(this).prop("src").indexOf("s_check.png")>0){
				$(this).prop("src","<%=path%>/images/marketing/s_check_no.png");
				show_equipment=0;
			}else{
				$(this).prop("src","<%=path%>/images/marketing/s_check.png");
				show_equipment=1;
			}
			reloadLeft();
	});
    //是否显示活动方式show_card
    $(document).on("click",".show_activity_way",function(e){
			if($(this).prop("src").indexOf("s_check.png")>0){
				$(this).prop("src","<%=path%>/images/marketing/s_check_no.png");
				show_activity_way=0;
			}else{
				$(this).prop("src","<%=path%>/images/marketing/s_check.png");
				show_activity_way=1;
			}
			reloadLeft();
	});
    //是否显示发送方式show_equipment
    $(document).on("click",".show_sendType",function(e){
			if($(this).prop("src").indexOf("s_check.png")>0){
				$(this).prop("src","<%=path%>/images/marketing/s_check_no.png");
				show_sendType=0;
			}else{
				$(this).prop("src","<%=path%>/images/marketing/s_check.png");
				show_sendType=1;
			}
	});
    //是否显示页脚信息show_equipment
    $(document).on("click",".show_foot_info",function(e){
			if($(this).prop("src").indexOf("s_check.png")>0){
				$(this).prop("src","<%=path%>/images/marketing/s_check_no.png");
				show_foot_info=0;
			}else{
				$(this).prop("src","<%=path%>/images/marketing/s_check.png");
				show_foot_info=1;
			}
			reloadLeft();
	});
    //是否显示页脚信息show_equipment
    $(document).on("click",".show_collect",function(e){
			if($(this).prop("src").indexOf("s_check.png")>0){
				$(this).prop("src","<%=path%>/images/marketing/s_check_no.png");
				show_collect=0;
			}else{
				$(this).prop("src","<%=path%>/images/marketing/s_check.png");
				show_collect=1;
			}
			reloadLeft();
	});
    
    //保存
    $('.x_button_y').click(function () {
    	save();
    });
    //下一步
    $('#bm_button').click(function () {
    	next_flag=true;
        save();
    	
	  
    });
    //重新选模板
     $('.again_chose_model').click(function () {
    	  window.history.back(); 
    });
    
    
    
    var title;
    var pic_urls;
    function showpic(){ 
    	document.getElementById("img").src = document.getElementById("x_inputfile").value 
    } 
    //下一步
    function next(){
    	
    }
    //取消
    function cancel() {
		
	}
    //上传图片
    function uploadImage() {
		
	}


    </script>



</body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.form/4.2.2/jquery.form.min.js"></script>

<script type="text/javascript" src="<%=path%>/js/marketing/lengthlimit.js"></script>
<script type="text/javascript">
	var activity_id;
	var access_token=$.cookie('access_token');
	var cid=$.cookie('cid');
	var uid=$.cookie('uid');
	//环境设施
	var equipment_facilities;
	//领券人提交信息
	var commit_info;
	//优惠券发送方式
	var send_type;
	//活动限制
	var activity_restrict;
	//活动限制标记
	var restrict_index;
	//活动介绍
	var activity_content;
	//活动细则
	var activity_detail_rule;
	//模板id
	var model_id;
	//原价
	var original_price;
	//活动价
	var discount_price;
	//微博二维码
	var weibo_qrcode;
	//微信二维码
	var weixin_qrcode;
	//活动图片
	var activity_pics;
	//标记此页面需要执行的操作
	var type;
	//标记编辑活动是否保存
	var save_tag=false;
	//搜索门店
	var key_word;
	
	var picObj=new Object();
	//活动头图
	var head_pic;
	
	
	var startIndex=0;
	var page_size=5;
	var next_flag=false;
	//活动状态
	var status="2";
	/* var status="2"; */
    var keyIndex=0;
	//请输入原价
	var priceHint;

	var extendFieldObj=new Object();
	var extendField="";
	var show_card=0;//是否显示商家名
	var show_equipment=0;//是否显示环境设施
	var show_activity_way=0;//是否显示活动方式
	var show_collect=0;//是否显示收集信息
	var show_sendType=0;//是否显示通知客户方式
	var show_foot_info=0;//是否显示页脚信息
	var card_text;//商家名片按钮文字
	var activity_content_text;//活动介绍自定义文字
	var activity_rule_text;//活动规则自定义文字
	
	$(function(){
		$(document).on("keyup","#firstname,#ziDingYi,#unitPrice,#groupPrice,#activityPresentation",function(e){
			if(e.keyCode == 13 && $(this).prop("id") != "activityPresentation"){
				var tabsId = document.getElementById('tabs');
				var length=tabsId.getElementsByTagName("li").length
				var obj_lis=tabsId.getElementsByTagName("li");
				console.log("----------------------->"+obj_lis.length);
				var temp=equipment_facilities.split(",");
				if(length<8){
					var tab = $.trim($(this).val());
					var sameName=false;
					 for(i=0;i<obj_lis.length;i++){
						 console.log("-------aa------>"+obj_lis[i].innerHTML.split('>')[1]);
					       if(obj_lis[i].innerHTML.split('>')[1]==tab){
					    	   sameName=true;
					       }
					  }
					if(sameName){
						promptDialog("自定义内容不能重复");
					}else{
						$("#ziDingYi").val("");
						$(this).parent().before('<li><img name="'+tab+'" src="<%=path%>/images/marketing/s_check.png" class="isChecked commit"/>'+tab+'</li>');
						console.log("tag---->"+tab);
					}
				}else{
					promptDialog("自定义个数超过最大限制");
				}
			}
			reloadLeft();
		});
		$(document).on("click",".commit",function(e){
			if($(this).prop("src").indexOf("s_check.png")>0){
				$(this).prop("src","<%=path%>/images/marketing/s_check_no.png");
			}else{
				$(this).prop("src","<%=path%>/images/marketing/s_check.png");
			}
			
			reloadLeft();
		});
		
		$(document).on("click",".isRadio",function(e){
			$(this).prop("src","<%=path%>/images/marketing/img_radio.png")
				.parent().parent().siblings().find("img").prop("src","<%=path%>/images/marketing/img_radio_n.png");
			restrict_index=this.id;
			
			/* for(var i in activity_restrict){
				alert(i);
				alert(activity_restrict[i]);
			} */
			reloadLeft();
		});
		
		//获取活动id
		activity_id=getQueryString("activity_id");
		//获取类型
		type=getQueryString("type");
		//获取模板id
		model_id=getQueryString("model_id");
		if(StringEmpty(activity_id)&&(type=="copy"||type=="edit")){
			$('#again_chose_model').hide();
	       getActivityInfo(activity_id);
	       activityStore();
		}else{
			reloadLeft();
		}
	});

	function reloadLeft(){
		var firstname = $("#firstname").val();
		equipment_facilities="";
		commit_info="";
		send_type="";
		$("#title").text(firstname);
		
		$(".s_detailed>li:eq(0)").html("");
		$("#tabs .isChecked[src$='s_check.png']").each(function(i,d){
			$(".s_detailed>li:eq(0)").append('<span><img src="<%=path%>/images/marketing/s_dg.png" />'+$(d).parent().text()+'</span>');
			equipment_facilities=equipment_facilities+","+$(this).attr("name");
			console.log(equipment_facilities);
		});
		var unitPrice = $("#unitPrice").val();
		var groupPrice = $("#groupPrice").val();
		var priceHint=$('#input_priceHint').val();
		$("#priceHint").text(priceHint);
		$("#unitPrice2").text(unitPrice);
		$("#groupPrice2").text(groupPrice);
		
		
		$(".s_hdjs>ol").html("");
		var activityPresentation = $.trim($("#activityPresentation").val());
		$.each(activityPresentation.split("\n"),function(i,d){
			d = $.trim(d);
			$(".s_hdjs>ol").append("<li>"+d+"</li>");
		});
		$("#activity_description").append('<li><a id="rule_text" href="javascript:;">活动细则</a></li>');
		
		$(".k_activity>#left_commit>.s_name_input").remove();
		
		$("#customerInfo .isChecked[src$='s_check.png']").each(function(i,d){
			var _name = $(this).prop("_name");
			var name = $.trim($(this).parent().text());
			$(".k_activity>#left_commit>.s_get_btn").before('<div class="s_name_input"><i>'+name+'</i><input type="text" name="'+_name+'"></div>');
			commit_info=commit_info+","+this.id;
			
		});
		<%-- if(commit_info==",commit_name"){
			$("#commit_mobile").attr("src","<%=path%>/images/marketing/s_check.png");
			$(".k_activity>.s_get_btn").before('<div class="s_name_input"><i>电话</i><input type="text" name="电话"></div>');
		} --%>
		$("#coupon_send_type .isChecked[src$='s_check.png']").each(function(i,d){
			send_type=send_type+","+this.id;
		});
		//赋值图片f
/* 		if($("#img1").prop("src").indexOf("/img_p.png")<0){
			console.log("tupian--》"+$("#img1").prop("src"));
			$("#banner").prop("src",$("#img1").prop("src"));
		} */
		
		
		
		
		if($("#erweima_weibo").prop("src").indexOf("s_check.png")>0 && $("#img4").prop("src").indexOf("/img_p.png")<0){
			$("#erweima_weibo2").prop("src",$("#img4").prop("src"));
		}
		if($("#erweima_weixin").prop("src").indexOf("s_check.png")>0 && $("#img5").prop("src").indexOf("/img_p.png")<0){
			$("#erweima_weixin2").prop("src",$("#img5").prop("src"));
		}
		
		
		send_type=send_type.replace(",","");
		equipment_facilities=equipment_facilities.replace(",","");
		commit_info=commit_info.replace(",","");
		if(StringEmpty(commit_info)){
			$(".s_get_btn").show();
		}else{
			$(".s_get_btn").hide();
		}
		
		
		//名片文字
		card_text=$("#input_card_text").val();
		if(StringEmpty(card_text)){
			 $("#sjmp").text(card_text);
		}else{
			card_text="商家名片";
			 $("#sjmp").text("商家名片");
		}
		   
		activity_content_text=$("#input_activity_content_text").val();
		if(StringEmpty(activity_content_text))
			$("#content_text").text(activity_content_text);
		
		activity_rule_text=$("#input_activity_rule_text").val();
		if(StringEmpty(activity_rule_text))
			$("#rule_text").text(activity_rule_text); 
		//是否显示名片
		if(show_card==0){
			$(".sjmp").hide();
		}else{
			$(".sjmp").show();
		}
	    //是否显示环境设施
		if(show_equipment==0){
			$("#li_environment").hide();
		}else{
			$("#li_environment").show();
		}
		if(show_activity_way==0){
			$("#h3_price").hide();
		}else{
			$("#h3_price").show();
		}
		
		if(show_foot_info==0){
			$('.s_footer').hide();
		}else{
			$('.s_footer').show();
		}
		if(show_collect==0){
			$("#left_commit").hide();
		}else{
			$("#left_commit").show();
		}
		for(var i in picObj){
			if(StringEmpty(picObj[i]))
			{
				$("#banner").prop("src",picObj[i]);
				return ;
			}
			if(i="key3"){
				$("#banner").prop("src","<%=path%>/images/marketing/k_banner.png");
			}
		}
	}


	//获取活动信息
	function getActivityInfo(activity_id) {
		var url="<%=path%>/activity/detail";
		$.post(url, {
			"access_token" : access_token,
			"cid" : cid,
			"uid" : uid,
			"activity_id" : activity_id,
		}, function(data) {
			
			if (data.status == 200&&data.data!=undefined) {
				model_id=data.data.model_id;
				
				initView(data.data);
			} else {
			}
		});
	}
	//初始化页面
	function initView(data){
		status=data.status;
		equipment_facilities=data.equipment_facilities;
		commit_info=data.commit_info;
		send_type=data.coupon_send_type;
		activity_restrict=data.activity_restrict;
		if(StringEmpty(data.name))
			document.getElementById('firstname').value = data.name;
		//设置图片
		if(StringEmpty(data.pic_url)){
			var pics = data.pic_url.split(",");
			for(var i=0;i<pics.length;i++){
				var id=parseInt(i)+parseInt(1); 
				var imgId="img"+id;
				document.getElementById(imgId).src =pics[i];
				switch (i) {
				case 0:
					picObj.key1=pics[i];
					$("#close1").show();
					break;
                case 1:
                	picObj.key2=pics[i];
                	$("#close2").show();
					break;
                case 2:
                	picObj.key3=pics[i];
                	$("#close3").show();
	                break;

				default:
					break;
				}
			}
		}
		//活动内容
		if(StringEmpty(data.description)){
			$('#activity_description').html(data.description);
		 	var description=data.description;
			var items=description.split("</li>");
			items=items.join("");
			items=items.split("<li>");
			items=items.join(""); 
			items.trim();
			document.getElementById('activityPresentation').value =items;
		}
		//活动细则
		if(StringEmpty(data.detail_rule)){
			var detail_rule=data.detail_rule;
			var items=detail_rule.split("</li>");
			items=items.join("");
			items=items.split("<li>");
			items=items.join(""); 
			document.getElementById('activity_detail_rule').value =items;
		}
		//活动限制	
		if(StringEmpty(data.activity_restrict)){
			var activity_restrict = JSON.parse(data.activity_restrict);
			$.each(activity_restrict, function(i) {
				switch (i) {
				case "like":
					document.getElementById('restrict_like').src ="<%=path%>/images/marketing/img_radio.png";
					document.getElementById('restrict_no').src ="<%=path%>/images/marketing/img_radio_n.png";
					document.getElementById('exampleInputName2').value = activity_restrict[i];
					restrict_index="restrict_like";
					break;
	            case "click":
	            	document.getElementById('restrict_click').src ="<%=path%>/images/marketing/img_radio.png";
	            	document.getElementById('restrict_no').src ="<%=path%>/images/marketing/img_radio_n.png";
	            	document.getElementById('exampleInputName1').value = activity_restrict[i];
	            	restrict_index="restrict_click";
					break;
	            case "transmit":
	            	document.getElementById('restrict_transmit').src ="<%=path%>/images/marketing/img_radio.png";
	            	document.getElementById('restrict_no').src ="<%=path%>/images/marketing/img_radio_n.png";
	            	document.getElementById('exampleInputName3').value = activity_restrict[i];
	            	restrict_index="restrict_transmit";
		            break;
		            
				default:
					document.getElementById('restrict_no').src ="<%=path%>/images/marketing/img_radio.png";
					break;
				}
			});
		}
		//设置价钱
		if(StringEmpty(data.discount_price))
			document.getElementById('unitPrice').value = data.discount_price;
		if(StringEmpty(data.original_price))
			document.getElementById('groupPrice').value = data.original_price;
		if(StringEmpty(data.bak2))
			document.getElementById('input_priceHint').value = data.bak2;
		//设置领券所需提交信息	
		if(StringEmpty(data.commit_info)){
			var commit_infos=data.commit_info;
			var commits=commit_infos.split(",");
			for(var i in commits){
				if(commits[i]=="commit_name")
					document.getElementById('commit_name').src ="<%=path%>/images/marketing/s_check.png";
				if(commits[i]=="commit_mobile")
					document.getElementById('commit_mobile').src ="<%=path%>/images/marketing/s_check.png";
				if(commits[i]=="commit_email")
					document.getElementById('commit_email').src ="<%=path%>/images/marketing/s_check.png";
				if(commits[i]=="commit_weibo")
					document.getElementById('commit_weibo').src ="<%=path%>/images/marketing/s_check.png";
				if(commits[i]=="commit_weixin")
					document.getElementById('commit_weixin').src ="<%=path%>/images/marketing/s_check.png";
				if(commits[i]=="commit_job")
					document.getElementById('commit_job').src ="<%=path%>/images/marketing/s_check.png";
				if(commits[i]=="commit_company")
					document.getElementById('commit_company').src ="<%=path%>/images/marketing/s_check.png";
			}
		}
		//设置优惠券发送方式
		if(StringEmpty(data.coupon_send_type)){
			var send=data.coupon_send_type;
			var sendTypes=send.split(",");
			for(var i in sendTypes){
				if(sendTypes[i]=="send_sms")
					document.getElementById('send_sms').src ="<%=path%>/images/marketing/s_check.png";
				if(sendTypes[i]=="send_email")
					document.getElementById('send_email').src ="<%=path%>/images/marketing/s_check.png";
				if(sendTypes[i]=="send_weibo")
					document.getElementById('send_weibo').src ="<%=path%>/images/marketing/s_check.png";
				if(sendTypes[i]=="send_generate")
					document.getElementById('send_generate').src ="<%=path%>/images/marketing/s_check.png";
			}
			
		}
		//设置二维码
		if(StringEmpty(data.weibo_qrcode)){
			weibo_qrcode=data.weibo_qrcode;
			document.getElementById('img5').src = data.weibo_qrcode;
			document.getElementById('erweima_weibo').src = "<%=path%>/images/marketing/s_check.png";
			document.getElementById('erweima_weibo2').src = data.weibo_qrcode;
			
		}
		if(StringEmpty(data.weixin_qrcode)){
			weixin_qrcode=data.weixin_qrcode;
			document.getElementById('img4').src = data.weixin_qrcode;	
			document.getElementById('erweima_weixin').src = "<%=path%>/images/marketing/s_check.png";
			document.getElementById('erweima_weixin2').src = data.weixin_qrcode;;
		}
		
		if(StringEmpty(data.equipment_facilities)){
			var temp=data.equipment_facilities;
			var equipment_facilities=temp.split(",");
			var equipmenHtml1='';
			equipmenHtml1+='<li class="s_fx_li1"><img name="免预约" id="free_subscribe" src="<%=path%>/images/marketing/s_check_no.png" class="isChecked commit" />免预约</li>';
			equipmenHtml1+='<li class="s_fx_li2"><img name="有停车位" id="parking_space" src="<%=path%>/images/marketing/s_check_no.png" class="isChecked commit" />有停车位</li>';
			equipmenHtml1+='<li class="s_fx_li3"><img name="适用全部门店" id="apply_all_store" src="<%=path%>/images/marketing/s_check_no.png" class="isChecked commit" />适用全部门店</li>';
			$('#tabs').html(equipmenHtml1);
			var equipmenHtml2='';
			for(var i in equipment_facilities){
				if(equipment_facilities[i]=="免预约"){
					document.getElementById("free_subscribe").src="<%=path%>/images/marketing/s_check.png";
				}else if(equipment_facilities[i]=="有停车位"){
					$("#parking_space").attr("src","<%=path%>/images/marketing/s_check.png");	
				}else if(equipment_facilities[i]=="适用全部门店"){
					$("#apply_all_store").attr("src","<%=path%>/images/marketing/s_check.png");
				}else{
					equipmenHtml2+='<li class="s_fx_li3"><img name="'+equipment_facilities[i]+'" id="apply_all_store"src="<%=path%>/images/marketing/s_check.png" class="isChecked commit" />'+equipment_facilities[i]+'</li>';
				}
			}
			equipmenHtml2+='<li class="s_fx_li4"><input type="text" placeholder="自定义" id="ziDingYi" /></li>'
			$('#tabs').append(equipmenHtml2);
		}
		//解析扩展字段
		if(StringEmpty(data.extendField)){
			var  extendField=data.extendField;
			for(var i in extendField){
				switch (extendField[i].extend_key) {
				case "show_card":
					show_card=extendField[i].extend_value;
					extendFieldObj.show_card=show_card;
					if(show_card==1){
						$(".show_card").attr("src","<%=path%>/images/marketing/s_check.png")
					}
					break;
				case "show_equipment":
					show_equipment=extendField[i].extend_value;
					extendFieldObj.show_equipment=show_equipment;
					if(show_equipment==1){
						$(".show_equipment").attr("src","<%=path%>/images/marketing/s_check.png")
					}
					
					break;
				case "show_activity_way":
					show_activity_way=extendField[i].extend_value;
					extendFieldObj.show_activity_way=show_activity_way;
					if(show_activity_way==1){
						$(".show_activity_way").attr("src","<%=path%>/images/marketing/s_check.png")
					}
					
					break;
				case "show_collect":
					show_collect=extendField[i].extend_value;
					extendFieldObj.show_collect=show_collect;
					if(show_collect==1){
						$(".show_collect").attr("src","<%=path%>/images/marketing/s_check.png")
					}
					
					break;
				case "show_sendType":
					show_sendType=extendField[i].extend_value;
					extendFieldObj.show_sendType=show_sendType;
					if(show_sendType==1){
						$(".show_sendType").attr("src","<%=path%>/images/marketing/s_check.png")
					}
					
					break;
				case "show_foot_info":
					show_foot_info=extendField[i].extend_value;
					extendFieldObj.show_foot_info=show_foot_info;
					if(show_foot_info==1){
						$(".show_foot_info").attr("src","<%=path%>/images/marketing/s_check.png")
					}
					
					break;
				case "card_text":
					card_text=extendField[i].extend_value;
					extendFieldObj.card_text=card_text;
					if(StringEmpty(card_text)){
						$('#input_card_text').val(card_text);
					}
					break;
				case "activity_content_text":
					activity_content_text=extendField[i].extend_value;
					extendFieldObj.activity_content_text=activity_content_text;
					if(StringEmpty(activity_content_text)){
						$('#input_activity_content_text').val(activity_content_text);
					}
					break;
				case "activity_rule_text":
					activity_rule_text=extendField[i].extend_value;
					extendFieldObj.activity_rule_text=activity_rule_text;
					if(StringEmpty(activity_rule_text)){
						$('#input_activity_rule_text').val(activity_rule_text);
					}
					break;

				default:
					break;
				}
			}
		}
		reloadLeft();
	}





	function save() {
		
		extendFieldObj.show_card=show_card;
		extendFieldObj.show_equipment=show_equipment;
		extendFieldObj.show_activity_way=show_activity_way;
		extendFieldObj.show_collect=show_collect;
		extendFieldObj.show_sendType=show_sendType;
		extendFieldObj.show_foot_info=show_foot_info;
		extendFieldObj.card_text=card_text;
		extendFieldObj.activity_content_text=activity_content_text;
		extendFieldObj.activity_rule_text=activity_rule_text;
		extendField=JSON.stringify(extendFieldObj);
		//获取输入的活动标题
		title=document.getElementById("firstname").value;
		var pics = document.getElementById("pics").getElementsByTagName("li");
		for(i=0;i<pics.length;i++){
			var  p=document.getElementById("x_inputfile").value; 
	    }
		var restrictObject = new Object();
		switch (restrict_index) {
		case "restrict_transmit":
			var transmitNum=document.getElementById("exampleInputName3").value; 
			restrictObject.transmit=transmitNum;
			break;
	    case "restrict_like":
	    	var likeNum=document.getElementById("exampleInputName2").value;
	    	restrictObject.like=likeNum;
			break;
	    case "restrict_click":
	    	var clickNum=document.getElementById("exampleInputName1").value; 
	    	restrictObject.click=clickNum;
	        break;
		default:
			break;
		}
		//获取活动限制
		activity_restrict=JSON.stringify(restrictObject);
		//获取活动
		/* activity_content=document.getElementById("activityPresentation").value; */
		var content=document.getElementById("activityPresentation").value;
		var contentTemp=content.split("\n");
		console.log("contentTemp---------->"+contentTemp.length);
		activity_content="";
		for(var i in contentTemp){
			if(StringEmpty(contentTemp[i]))
			  activity_content=activity_content+"<li>"+contentTemp[i]+"</li>\n";
		} 
		//获取活动细则
		/* activity_detail_rule=document.getElementById("activity_detail_rule").value; */
		var ruleContent=document.getElementById("activity_detail_rule").value; 
		var ruleTemp=ruleContent.split("\n");
		activity_detail_rule="";
		for(var i in ruleTemp){
			if(StringEmpty(ruleTemp[i]))
			  activity_detail_rule=activity_detail_rule+"<li>"+ruleTemp[i]+"</li>\n";
		} 
		//获取价钱
		discount_price=document.getElementById('unitPrice').value ;
		original_price=document.getElementById('groupPrice').value ;
		priceHint=$('#input_priceHint').val();
		activity_pics="";
		//图片 
		for(var i=0 in picObj){
			if(picObj[i]!=undefined){
				head_pic=picObj[i];
				activity_pics=activity_pics+","+picObj[i];
			}
			
			if(StringEmpty(picObj["key1"])){
				head_pic=picObj["key1"];
			}else if(StringEmpty(picObj["key2"])){
				head_pic=picObj["key2"];
			}else if(StringEmpty(picObj["key3"])){
				head_pic=picObj["key3"];
			}
		}
		
		if(next_flag){
			var commitFlag=false;
			if(StringEmpty(commit_info)){
				var tempCommit=commit_info.split(",");
				for(var i=0 ;i<tempCommit.length;i++){
					if(tempCommit[i]=="commit_mobile"||tempCommit[i]=="commit_email"||tempCommit[i]=="commit_weibo"){
						commitFlag=true;
					}
				}
			}else{
				commitFlag=true;
			}
			
			if(!commitFlag){
				promptDialog("收集信息至少包含手机号、邮箱、微博其中一项");
				return ;
			}
			
			
			if(StringEmpty(activity_pics)&&StringEmpty(send_type)&&title.length<26&&StringEmpty(activity_content)&&StringEmpty(activity_detail_rule)&&StringEmpty(title)&&StringEmpty(commit_info)){
				activity_pics=activity_pics.replace(",","");
				if(type=="edit"||save_tag){
					editActivity();
				}else{
					createActivity();
				}
			}else if(!StringEmpty(title)){
				promptDialog("请填写活动主题");
			}else if(title.length>20){
				promptDialog("活动主题不能超过25个字");
			}else if(!StringEmpty(activity_content)){
				
				promptDialog("请填写活动内容");
			}else if(!StringEmpty(activity_detail_rule)){
				promptDialog("请填写活动细则");
			}else if(!StringEmpty(send_type)){
				promptDialog("请至少选择一种通知方式");
			}else if(!StringEmpty(activity_pics)){
				promptDialog("请上传活动图片");
			}
			else if(!StringEmpty(commit_info)){
				promptDialog("请选择收集信息");
			}
		}else{
			if(!StringEmpty(title)){
				promptDialog("请填写活动主题");}
			activity_pics=activity_pics.replace(",","");
			if(type=="edit"||save_tag){
			    console.log("edit---1111");
				editActivity();
			}else{
				console.log("create---1111");
				createActivity();
			}
		}
	}
	//创建活动
	function createActivity() {
		var url = "<%=path%>/activity/create";
		$.post(url, {
			"access_token" :access_token,
			"cid" : cid,
			"uid" : uid,
			"activity_name" : title,
			"coupon_send_type" : send_type,
			"model_id" : model_id,
			"activity_content" : "cecook2017"+activity_content,
			"commit_info" : commit_info,
			"activity_restrict" : activity_restrict,
			"equipment_facilities" : equipment_facilities,
			"discount_price" : discount_price,
			"original_price" : original_price,
			"weixin_qrcode" : weixin_qrcode,
			"weibo_qrcode" : weibo_qrcode,
			"activity_pics" : activity_pics,
			"activity_detail_rule" : "cecook2017"+activity_detail_rule,
			"tag" : "sys",
			"model_id" : model_id,
			"head_pic" : head_pic,
			"status":status,
			"priceHint":priceHint,
			"extendField":extendField,
		}, function(data) {
			
			if (data.status == 200) {
				activity_id=data.activity_id;
				save_tag=true;
				addStore();
			} else {
				promptDialog(data.message);
			}
		});
	}
	//编辑活动（更新）
	function editActivity() {
		var url = "<%=path%>/activity/editActivity";
		$.post(url, {
			"access_token" :access_token,
			"cid" : cid,
			"uid" : uid,
			"activity_name" : title,
			"coupon_send_type" : send_type,
			"model_id" : model_id,
			"activity_content" : "cecook2017"+activity_content,
			"commit_info" : commit_info,
			"activity_restrict" : activity_restrict,
			"equipment_facilities" : equipment_facilities,
			"discount_price" : discount_price,
			"original_price" : original_price,
			"weixin_qrcode" : weixin_qrcode,
			"weibo_qrcode" : weibo_qrcode,
			"activity_pics" : activity_pics,
			"activity_detail_rule" : "cecook2017"+activity_detail_rule,
			"activity_id" : activity_id,
			"head_pic" : head_pic,
			"status":status,
			"priceHint":priceHint,
			"extendField":extendField,
		}, function(data) {
			
			if (data.status == 200) {
				save_tag=true;
				addStore();
			} else {
				promptDialog("保存失败");
			}
		});
	}
	
	var flag=false;
	function fileloadon(upload_type) {
	    $("#_weixin_qrcode").submit(function () {  
	    	if(flag){
	    		return ;
	    	}
	    	flag=true;
	        $("#_weixin_qrcode").ajaxSubmit({
	            type: "post",
	            url: "${pageContext.request.contextPath}/api/uploadfile/file",
	            data:{"typename":"weixin_qrcode"},
	            success: function (data1) {
	            	weixin_qrcode=data1.realSavePath;
	            	$("#img4").attr('src',weixin_qrcode);
	            	$("#erweima_weixin2").attr('src',weixin_qrcode); 
	            	$("#erweima_weixin").attr('src','<%=path%>/images/marketing/s_check.png'); 
	            },
	            error: function (msg) {
	            	promptDialog("文件上传失败");
	            }
	        });
	        return false;
	    });
	    
	    $("#_weibo_qrcode").submit(function () {  
	    	if(flag){
	    		return ;
	    	}
	    	flag=true;
	        $("#_weibo_qrcode").ajaxSubmit({
	            type: "post",
	            url: "${pageContext.request.contextPath}/api/uploadfile/file",
	            data:{"typename":"weibo_qrcode"},
	            success: function (data1) {
	            	weibo_qrcode=data1.realSavePath;
	            	$("#img5").attr('src',weibo_qrcode); 
	            	$("#erweima_weibo2").attr('src',weibo_qrcode); 
	            	$("#erweima_weibo").attr('src','<%=path%>/images/marketing/s_check.png'); 
	            	
	            },
	            error: function (msg) {
	            	promptDialog("文件上传失败");
	            }
	        });
	        return false;
	    });
	    switch (upload_type) {
	    
		case "weixin":
			flag=false;
			$("#_weixin_qrcode").submit();
			break;
		case "weibo":
			flag=false;
			$("#_weibo_qrcode").submit();
			break;
	
		default:
			break;
		}
	}
	
	//门店名称
    var name;
    //地址
    var address;
    //电话
    var phone;
    //门店id
    var id;
    //关键字
    var key_word;
    var store_names=new Array();
    var store_ids=new Array();
    var mdstore;
    
    //分页
    var startIndex = 0;
    var pageSize = 5;
    var currentPage = 1;
    var pageCount = 0;
    
    function colseModal(){
    	$('#store_modal').modal('hide');
    }
    
    function determineStore(){
    	store_names.length=0;
    	store_ids.length=0;
    	$("#bm_cstore .x_CheckBox[src$='s_check.png']").each(
    			function(i, d) {
    				var name = $(this).attr("cname");
    				store_names[i]=name;
    				store_ids[i]=this.id;
    	});
    	var html='';
    	for(var i in store_names){
    		html += '<li id="store_line'+i+'" indexNum="'+i+'" class="delete_md_detail col-md-4 text-left" cid="'+store_names[i]+'" >'+store_names[i]+'<img indexNum="'+i+'" cid="'+store_names[i]+'" id="delete_store" src="<%=path%>/images/marketing/close.png" class="x_lista"></li>';
    	}
    	$('#bm_md_list').html(html);
    	$('#store_modal').modal('hide');
    }
   
   //打叉移除选择的门店
    $(document).on('click','#delete_store',function(){
    	var index=$(this).attr("indexNum");
    	var lineId="#store_line"+$(this).attr("indexNum");
    	$(lineId).remove();
    	store_ids.splice(index,1); 
    }); 
   //勾选后点击确定
   var address;
    $('#bm_queque').click(function(){
    	$('.x_popup_add,.issue_add').hide();
    	store_names.length=0;
    	store_ids.length=0;
    	$("#bm_cstore .x_CheckBox[src$='s_check.png']").each(
				function(i, d) {
					var name = $(this).attr("cname");
					address= $(this).attr("address");
					store_names[i]=name;
					store_ids[i]=this.id;
		});
    	$('#li_address').text("地址:"+address);
    	$('#store_num').text("全部"+store_ids.length+"家分店");
    	
    	var html='';
    	for(var i in store_names){
    		html += '<li id="store_line'+i+'" indexNum="'+i+'" class="delete_md_detail col-md-4" cid="'+store_names[i]+'" >'+store_names[i]+'<img indexNum="'+i+'" cid="'+store_names[i]+'" id="delete_store" src="<%=path%>/images/marketing/close.png" class="x_lista"></li>';
    	}
    	$('#bm_md_list').html(html);
    });
    
  
  
  
  
	var tag;
	var flag=false;
	var file_path;
	function uploadPic(upload_type) {
		tag=upload_type;
		file_path='filepath'+upload_type;
        $("#upload_pic").submit(function (event) {  
        	if(flag){
        		return ;
        	}
        	flag=true;
            $("#upload_pic").ajaxSubmit({
                type: "post",
                url: "${pageContext.request.contextPath}/api/uploadfile/file",
                data:{"typename":file_path},
                success: function (data1) {
                	if(StringEmpty(data1.realSavePath))
                	setImagePic(data1.realSavePath);
                },
                error: function (msg) {
                	promptDialog("文件上传失败");
                }
            });
            return false;
        });
        flag=false;
        $("#upload_pic").submit();
	}
	
	//设置活动图片
	function setImagePic(pic){
		switch (tag) {
		case 1:
			$("#img1").attr('src',pic);
			var key1="pic"+1;
			picObj.key1=pic;
			reloadLeft();
			
			$("#close1").show();
			break;
		case 2:
			$("#img2").attr('src',pic); 
			console.log(2);
			var key2="pic"+2;
			picObj.key2=pic;
			$("#close2").show();
			break;
		case 3:
			$("#img3").attr('src',pic); 
			console.log(4);
			var key3="pic"+3;
			picObj.key3=pic;
			$("#close3").show();
			break;
		default:
			break;
		}
	}
	 //获取活动门店信息
    function activityStore(){
    	var url = "<%=path%>/activityStore/ajaxListRelationActivityStore";
    	$.post(url,{
    		"access_token" : access_token,
			"cid" : cid,
			"uid" : uid,
			"activityId" : activity_id,
    	},function(data){
    		
    		if(data.error_code == "0"){
    			var stores=data.data;
    			var html='';
    	    	for(var i in stores){
    	    		store_ids[i]=stores[i].id;
    	    		store_names[i]=stores[i].name;
    	    		html += '<li id="store_line'+i+'" indexNum="'+i+'" class="delete_md_detail" cid="'+store_names[i]+'" >'+store_names[i]+'<img indexNum="'+i+'" cid="'+store_names[i]+'" id="delete_store" src="<%=path%>/images/marketing/close.png" class="x_lista"></li>';
    	    	}
    	    	$('#li_address').text("地址:"+stores[0].address);
    	    	$('#store_num').text("全部"+store_ids.length+"家分店");
    	    	$('#bm_md_list').html(html);
    		}else{
    		}
    	});
    }
    
    //保存用戶选择的门店
    function addStore(){
    	var storeIds=store_ids.join(",");
    	var url = "<%=path%>/activityStore/ajaxInsertBatch";
    	$.post(url,{
    		"access_token" : access_token,
			"cid" : cid,
			"uid" : uid,
			"activityId" : activity_id,
			"storeIds" : storeIds,
    	},function(data){
    		
    		if(next_flag){
    			window.location.href = "<%=path%>/api/bm/ui/createActivity3?activity_id="+activity_id;
    		}else{
        			successDialog("保存成功");
    		}
    		
    		
    	});
    }
	
    $(document).on("click", ".ad_close", function() {
    	var imageId="#"+$(this).attr("imageId");
    	var index=$(this).attr("indexNum");
    	$(this).hide();
		$(imageId).attr("src","<%=path%>/images/marketing/img_p.png");
		switch (index) {
		case "1":
			picObj.key1=undefined;
			break;
		case "2":
			picObj.key2=undefined;
			break;
		case "3":
			picObj.key3=undefined;
			break;

		default:
			break;
		}
		reloadLeft();
    });
    
  //监听离开页面
	document.onclick = function (event)

	  {

	  var e = event || window.event;

	  var elem = e.srcElement||e.target;

	          while(elem){   
	              if(elem.id == "menuContent"||elem.id =="more_but") {  
	                      return;
	              }  
	              elem = elem.parentNode;       
	          } 
	          upd();
	      } 
	  
	function upd(){
		  if(StringEmpty(activity_id)){
	    	  unLockActivity();
	      }
	  }
	  function unLockActivity(){
        	var url= "<%=path%>/activity/unlock";
        	$.post(url, {
        		"access_token" : access_token,
				"cid" : cid,
				"uid" : uid,
				"id" : activity_id,
			}, function(data) {
				
			});
      }
	
	
	//获取参数
	function getQueryString(name) {
		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
		var r = window.location.search.substr(1).match(reg);
		if (r != null)
			return unescape(r[2]);
		return null;
	}
	
	//判断字符串是否为空
	function StringEmpty(content) {
		if (content == undefined || content == "" || content == null) {
			return false;
		} else {
			return true;
		}
	}
	
	
 </script>


</html>
